<#assign base=request.contextPath />
<#assign oneLabel="ERP管理">

<#assign twoLabel="合同管理">
<#assign twoUrl=base+"/contract/list">

<#assign leafLabel="其他开支明细">
<!DOCTYPE html>
<html lang="en">
<head>
	<#include "/commons/headImport.ftl">
</head>
<body>
<#include "/commons/header.ftl">
<form class="form-horizontal" name="formName" method="post">
<#include "/commons/hiddenField.ftl">
<div class="row">
	<div class="col-xs-12">
		<#include "_contract_base.ftl">

		<div class="col-sm-12">
			<div class="widget-box transparent">
				<div class="widget-header widget-header-flat">
					<div class="visible-md visible-lg hidden-sm hidden-xs btn-group">
						<a class="btn btn-xs btn-success" id="other_id">
							<i class="icon-plus bigger-110"></i>其他支出
						</a>
					</div>
				</div>

				<div class="widget-body">
					<div class="widget-main no-padding">
						<table class="table table-striped table-bordered">
							<thead class="thin-border-bottom">
								<tr>
									<th class="center" width="5%">#</th>
									<th width="10%">支出类型</th>
									<th width="10%">日期</th>
									<th width="15%">名称</th>
									<th width="10%">金额</th>
									<th width="30%">备注</th>
									<th width="20%"></th>
								</tr>
							</thead>
							<tbody>
								<#if contractDO.paymentList??>
								<#list contractDO.paymentList as pay>
								<tr>
									<td class="center">${pay_index+1}</td>
									<td><span class="label label-sm label-warning arrowed arrowed-righ">其他支出</span></td>
									<td>${pay.buyDate?string("yyyy-MM-dd")}</td>
									<td>${pay.name!'--'}</td>
									<td>${(pay.pageAmount?string.currency)!0.0}</td>
									<td>${pay.remark!''}</td>
									<td>
										<div class="visible-md visible-lg hidden-sm hidden-xs btn-group">
											<a class="btn btn-minier btn-success" href="javascript:openPaymentEdit('${pay.id}');" title="编辑">
												<i class="icon-edit bigger-120"></i>编辑
											</a>
											<a class="btn btn-minier btn-danger" href="javascript:delPaymentRow('${base}/payment/delete/${pay.id}');" title="删除">
												<i class="icon-trash bigger-120"></i>删除
											</a>
										</div>
									</td>
								</tr>
								</#list>
								</#if>
								<#if !contractDO.paymentList?? ||((contractDO.paymentList)?size==0)>
									<tr>
										<td colspan="18" class="center">没有查询任何数据</td>
									</tr>
								</#if>
							</tbody>
						</table>
					</div><!-- /.widget-main -->
				</div><!-- /.widget-body -->
			</div><!-- /.widget-box -->
		</div><!-- /.col -->				
	</div><!-- /.col -->
</div><!-- /.row -->
</form>

<div class="hr hr32 hr-dotted"></div>

<div class="clearfix">
	<div class="col-md-offset-3 col-md-9">
		<button class="btn btn-xs return_class" type="button" url="${base}/contract/list">
			<i class="icon-reply bigger-110"></i>返回
		</button>
	</div>
</div>

<#include "/commons/footer.ftl">
</body>
<script src="${base}/static/layer/layer.js"></script>
<script type="text/javascript">
	jQuery(function($) {
	   $("#other_id").click(function(){
			layer.open({
		      type: 2,
		      title: '其他支出',
		      maxmin: true,
		      shadeClose: true, //点击遮罩关闭层
		      area : ['800px' , '450px'],
		      content: '${base}/payment/addOther?contractId=${contractDO.id!0}'
		    });
	   });
	});
	
	function openPaymentEdit(id) {
		var url='${base}/payment/editOther?paymentId='+id;
		layer.open({
	      type: 2,
	      title: '编辑支出',
	      maxmin: true,
	      shadeClose: true, //点击遮罩关闭层
	      area : ['800px' , '450px'],
	      content: url
	    });
	}
	
	function delPaymentRow(url){
		layer.confirm('确定要删除？', {
		  btn: ['删除','取消']
		}, function(){
			layer.load(2);
			$.get(url,function(data){
			     if(data.success){
			     	layer.msg("新增成功");
			     	layer.closeAll('loading');
			     	window.location.reload();
			     }else{
			     	var json = JSON.stringify(data.msg);
			     	layer.msg(json);
			     	layer.closeAll('loading');
			     }
			 });
		}, function(){
		});
	}
</script>
</html>
